﻿

using System;
using System.IO;
using WCFClient.FileOpeatorServiceReference;



namespace WCFClient
{
    class Program
    {
        static void Main(string[] args)
        {
            #region 
            var fileName = "51Testing电子杂志.rar";

            var path = AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName;
            var fileStream = File.ReadAllBytes(path);
            if (fileStream == null || (fileStream != null && fileStream.Length == 0))
            {
                Console.WriteLine("未找到文件");
                return;
            }
            MemoryStream stream = new MemoryStream(fileStream);
            using (WCFClient.FileOpeatorServiceReference.FileOpeatorClient client = new FileOpeatorClient("BasicHttpBinding_IFileOpeator"))
            {
                Console.WriteLine("开始上传字节大小：" + stream.Length + DateTime.Now.ToString());
                client.UpLoadFile(fileName, stream);
                Console.WriteLine("结束上传：" + DateTime.Now.ToString());


                Console.WriteLine("开始下载字：" + DateTime.Now.ToString());
                var streamObj = client.DownLoadFile(fileName);
                Console.WriteLine("结束下载:字节大小：" + streamObj.Length + "；" + DateTime.Now.ToString());

            }

            Console.Read();

            #endregion
        }
    }
}
